<?php 
/**
 *   Joomdiet - components/views/dietcalibratoritem/tmpl/default.php
 *   Author: Juan Dapena Paz (juan@bittingbits.com)
 *   Copyright (C) 2010 Bitting Bits S.L.
 *
 *   This program is free software: you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation, either version 3 of the License, or
 *   (at your option) any later version.
 *
 *   This program is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *   GNU General Public License for more details.
 *
 *   You should have received a copy of the GNU General Public License
 *   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
defined('_JEXEC') or die('Restricted access'); ?>
<div class="recipeitem" id="recipeitem<?php echo $this->recipeid; ?>">
    <div>
        <div class="lefttoolbar"><span><b><?php echo $this->recipe->name; ?></b></span></div>
        <input type="hidden" name="itemtype<?php echo $this->recipeid; ?>" id="itemtype<?php echo $this->recipeid; ?>" value="<?php echo $this->itemtype; ?>" />
        <div class="righttoolbar"><input type="button" class="removerecipeitem" id="removerecipeitem<?php echo $this->recipeid; ?>" /></div>
    </div>    
    <div class="float"></div>
    <div class="recipeingredients">
        <?php 
        if ($this->itemtype == 1) {
        foreach ($this->ingredients as $i => $food) { ?>
            <div>
                <div class="lefttoolbar"><?php echo $food->name; ?></div>
                <div class="righttoolbar">
                    <span><?php echo $this->amounts[$i]->amount; ?></span>
                    <span><?php echo JText::_('COM_JOOMDIET_GR')?></span>
                </div>
            </div>
            <div class="float">
        <?php } } ?>
        <div>
            <div class="righttoolbar" style="border-top: 1px solid #CCC">
                <span><b><?php echo JText::_('COM_JOOMDIET_TOTAL'); ?>:</b></span>
                <?php
                    $total = 0;
                    if ($this->itemtype == 1) {
                    foreach ($this->amounts as $amount) {
                        $total += $amount->amount;
                    } } else {
                        $total = $this->amount;
                    }
                ?>
                <span><?php echo $total; ?> <?php echo JText::_('COM_JOOMDIET_GR'); ?></span>
                <input type="hidden" name="amount<?php echo $this->recipeid; ?>" id="amount<?php echo $this->recipeid; ?>" value="<?php echo $total; ?>" />
            </div>
        </div>
        <div class="float">
    </div>
</div>
